package com.kfm.model;

import com.kfm.model.group.AccountGroupForSave;
import com.kfm.model.group.AccountGroupForUpdate;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
public class Account {

    @NotNull(message = "id不能为空",groups = {AccountGroupForUpdate.class})
    private Integer id;

    @NotNull(groups = {AccountGroupForUpdate.class, AccountGroupForSave.class})
    @Length(min = 2,groups = {AccountGroupForUpdate.class, AccountGroupForSave.class})
    private String name;

    @Length(min = 6,max = 14,message = "【用户名的长度需要在6-14之间】",groups = {AccountGroupForUpdate.class, AccountGroupForSave.class})
    private String username;

    @Length(min = 6,max = 20,message = "密码的长度应该在6-20之间",groups = {AccountGroupForUpdate.class, AccountGroupForSave.class})
    private String password;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createDate;
}
